namespace Scap.Data.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class db6 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.ScapEmployeeAssistances", "Employee_Id", "dbo.ScapEmployees");
            DropForeignKey("dbo.ScapEmployeeAssistances", "Device_Id", "dbo.ScapDevices");
            DropIndex("dbo.ScapEmployeeAssistances", new[] { "Employee_Id" });
            DropIndex("dbo.ScapEmployeeAssistances", new[] { "Device_Id" });
            RenameColumn(table: "dbo.ScapEmployeeAssistances", name: "Employee_Id", newName: "EmployeeId");
            RenameColumn(table: "dbo.ScapEmployeeAssistances", name: "Device_Id", newName: "DeviceId");
            AddForeignKey("dbo.ScapEmployeeAssistances", "EmployeeId", "dbo.ScapEmployees", "Id", cascadeDelete: true);
            AddForeignKey("dbo.ScapEmployeeAssistances", "DeviceId", "dbo.ScapDevices", "Id", cascadeDelete: true);
            CreateIndex("dbo.ScapEmployeeAssistances", "EmployeeId");
            CreateIndex("dbo.ScapEmployeeAssistances", "DeviceId");
        }
        
        public override void Down()
        {
            DropIndex("dbo.ScapEmployeeAssistances", new[] { "DeviceId" });
            DropIndex("dbo.ScapEmployeeAssistances", new[] { "EmployeeId" });
            DropForeignKey("dbo.ScapEmployeeAssistances", "DeviceId", "dbo.ScapDevices");
            DropForeignKey("dbo.ScapEmployeeAssistances", "EmployeeId", "dbo.ScapEmployees");
            RenameColumn(table: "dbo.ScapEmployeeAssistances", name: "DeviceId", newName: "Device_Id");
            RenameColumn(table: "dbo.ScapEmployeeAssistances", name: "EmployeeId", newName: "Employee_Id");
            CreateIndex("dbo.ScapEmployeeAssistances", "Device_Id");
            CreateIndex("dbo.ScapEmployeeAssistances", "Employee_Id");
            AddForeignKey("dbo.ScapEmployeeAssistances", "Device_Id", "dbo.ScapDevices", "Id");
            AddForeignKey("dbo.ScapEmployeeAssistances", "Employee_Id", "dbo.ScapEmployees", "Id");
        }
    }
}
